<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Home</title>
<style>
#header {
	background-color:black;
	color:white;
	text-align:center;
    padding:20px;}
#nav {
	background-color:#eeeeee;
	height:400px;
	width:200px;
	float:left;
	text-align:center;
	padding:5px;
}

#section {
	float:left;
	height:400px;
	width:800px;
	text-align:center;
	padding:35px;
}
</style> 
</head>
<body>
<div id="header">
    <h1>首页</h1>
</div> 
<div id="nav">
	<b>
	<?php
	header('Content-type:text/html;charset=UTF-8');
	session_start();
	include_once("../class/mysqlclass.php");
	$name = $_SESSION['usn'];
	$pdo=new my();
	echo $pdo->ShowPhoto($name);
	?>
	<br>
	<a href="./info.php">个人信息</a><br>
	<a href="../html/article.html">文章管理</a><br>
	<a href="./login.php">注销登录</a><br>
	<form action="managementsystem.php?act=login" method="post" >
		<input type="password" name="password" placeholder="管理密码" /><br>
		<input type="submit" name="submit" value="进入管理系统" />
	</form>
	</b>
</div>
<?php
echo '<div id="section">'.$name.',你好！欢迎来到您的熊猫博客首页!';
echo '<hr/>';
//有文章则输入后终止php，没有则输出没有文章
$res = $pdo->LastArticle();
foreach($res as $var){
	if($var['title']!=NULL){
		echo '<p style="color:red;">你最新的一篇文章：<br><br></p>';
		echo '<p style="text-align:center"><big>'.$var['title'].'</big><br>';
        echo '<small>作者--'.$var['author'].'</small><br><br><b>'.$pdo->Limit($var['description'],20).'<br><br>';
        echo $pdo->Limit($var['content'],540).'</b><br></p></div>';
        exit();		
	}
}
echo '你还没有发表过文章，赶快去发挥你才华吧！';
echo '<a href="./write.php">点击进入->编写文章</a>';
?>
</body>
</html>